package com.johnny.xia.base;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class CallTest2{

    public static void main2(String[] args){

        int[] nums = new int[] { 499, 999, 1999, 2999, 3999, 4000 };

        List<Integer> callsControlList = new ArrayList<>();
        callsControlList.add(0);
        callsControlList.add(500);
        callsControlList.add(1000);
        callsControlList.add(2000);
        callsControlList.add(3000);
        callsControlList.add(4000);

        Map<Integer, int[]> map = new LinkedHashMap<Integer, int[]>(3);
        map.put(700, new int[] { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 });
        map.put(1000, new int[] { 2, 2, 2, 2, 1, 1, 1, 1, 1, 1 });
        map.put(1500, new int[] { 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 });

        List<Integer> pdays = new ArrayList<>();
        pdays.add(700);
        pdays.add(1000);
        pdays.add(1500);

        //贡献度基数
        int base = 100000;

        int[] vips = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

        int gxd[] = new int[] { 100000, 200000, 300000, 400000 };

        for (int gongxian : gxd){
            for (int num : nums){
                String s =gongxian+"|"+num+"|";
                String s2="";
                for (int vip : vips){
                    int totalCon = 0;
                    for (int j = callsControlList.size() - 1; j >= 0; j--){
                        if (num >= callsControlList.get(j)){
                            totalCon = j + 1;
                            break;
                        }
                    }

                    int dayTotalCon = 0;
                    for (int j = pdays.size() - 1; j >= 0; j--){
                        if (num >= pdays.get(j)){
                            dayTotalCon = map.get(pdays.get(j))[vip];
                            break;
                        }
                    }

                    int after = totalCon + dayTotalCon - gxd[0] / base;
//                    s2+=after+"|";
                    System.out.println(gongxian + "|" + vip + "|" + num + "|" + (after >= 6 ? 6 : (after < 1 ? 1 : after)) + "|" + totalCon + "|" + dayTotalCon + "|" + (gxd[0] / base));
                    System.out.println(s+s2);

                }
            }
        }

    }

        public static void main(String[] args){
            
            int[] nums = new int[]{499,700,999,1000,1500,1999,2999,3999,4000};
            
            List<Integer> callsControlList = new ArrayList<>();
            callsControlList.add(0);
            callsControlList.add(500);
            callsControlList.add(1000);
            callsControlList.add(2000);
            callsControlList.add(3000);
            callsControlList.add(4000);
    
            Map<Integer, int[]> map = new LinkedHashMap<Integer, int[]>(3);
            map.put(700, new int[] { 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 });
            map.put(1000, new int[] {2, 2, 2, 2, 1, 1, 1, 1, 1, 1 });
            map.put(1500, new int[] {3, 3, 3, 3, 2, 2, 2, 2, 2, 2 });
            
            List<Integer> pdays = new ArrayList<>();
            pdays.add(700);
            pdays.add(1000);
            pdays.add(1500);
            
            int newbaby=1500;
            
            //贡献度基数
            int base=100000;
            
//            int[] vips = new int[]{0,1,2,3,4,5,6,7,8,9};
            int[] vips = new int[]{0};
            
            int gxd[] = new int[]{9000,100000,200000,300000,400000};

//            int gxd[] = new int[]{120000};
            
            int totalGxd = 120000;
            
            for(int vip : vips){
                for(int gongxian : gxd){
                    for(int num : nums){
                        
                        int totalCon = 0;
                        for(int j=callsControlList.size()-1;j>=0;j--){
                            if(num >= callsControlList.get(j)){
                                totalCon = j+1;
                                break;
                            }
                        }
                        
                        int dayTotalCon = 0;
                        if(num > newbaby){
                            for(int j=pdays.size()-1;j>=0;j--){
                                if(num >= pdays.get(j)){
                                    dayTotalCon = map.get(pdays.get(j))[vip];
                                    break;
                                }
                            }
                        }
                        
                        int after = totalCon+dayTotalCon-gxd[0]/base;
                        
                        System.out.println("贡献度"+gongxian+",VIP"+vip+" 获得数量"+num+"之前，话费难度："+(after >= 6 ? 6 :(after <1 ? 1:after))+"[总量难度："+totalCon+",日总难度："+dayTotalCon+",扣减"+(gxd[0]/base)+"]");
//                        System.out.println(gongxian+"|"+vip+"|"+num+"|"+(after >= 6 ? 6 :(after <1 ? 1:after))+"|"+totalCon+"|"+dayTotalCon+"|"+(gxd[0]/base));
                        
                    }
                    
    //                System.out.println();
                }
            }
            
            
    
        }
}
